#include <sys/eventfd.h>
#include "../source/Server.hpp"
int main()
{
    //int fd = eventfd(int initval,int flags)
    //EFD_CLOEXEC  : 不可复制，子进程不可复制父进程的文件描述符
    //EFD_NONBLOCK  : 非阻塞
    int fd = eventfd(0,EFD_CLOEXEC | EFD_NONBLOCK);
    if (fd < 0){
        ERR_LOG("create fd error!!!");
        abort();
    }
    while(true){
        uint64_t val = 1;
        write(fd,&val,sizeof(val));
        write(fd,&val,sizeof(val));
        val = 10;
        write(fd,&val,sizeof(val));
        sleep(1);
        uint64_t ret = 0;
        read(fd,&ret,sizeof(ret));
        DBG_LOG("notice times: %ld",ret);
    }
    close(fd);
    return 0;
}